package a66weding.com.jiehuntong.common;

import android.app.Activity;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * 这是一个我的界面下Activity的管理器
 * Created by Administrator on 2016/7/14.
 */
public class MyMainActivityManager {

    private Map<String,Activity> mActivityMap=new HashMap<String,Activity>();

    /**
     * 添加一个activity
     * @param activityName
     * @param activity
     */
    public void addActivity(String activityName,Activity activity){
        mActivityMap.put(activityName,activity);
    }


    /**
     * 删除一个activity
     * @param activityName
     */
    public void removeActivity(String activityName){
        mActivityMap.remove(activityName);
    }

    public void exitApp(){
        Set<Map.Entry<String, Activity>> entries = mActivityMap.entrySet();

        for (Map.Entry<String, Activity> entyr : entries) {
            Activity mactivity = entyr.getValue();
            System.out.println(mactivity);
            if(mactivity!=null) {
                mactivity.finish();
            }
        }

    }




}

